var _timer = 30000;
var _split = 1;
var _id = 0;
var _status = "资料读取中...";

var g_numcolor = [0,1,1,2,2,3,3,1,1,2,2,3,1,1,2,2,3,3,1,1,2,3,3,1,1,2,2,3,3,1,1,2,3,3,1,1,2,2,3,3,1,2,2,3,3,1,1,2,2,3];
var colors = ["","red", "blue", "green"];
var XH = null;
var XH1= null;
if (window.XMLHttpRequest)
{// code for all new browsers
    XH = new XMLHttpRequest();
    XH1 = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{// code for IE5 and IE6
  XH = new ActiveXObject("Microsoft.XMLHTTP");
  XH1 = new ActiveXObject("Microsoft.XMLHTTP");
} else 
  alert("Your browser does not support XMLHTTP.");

var timer_id;
var chkbutmod = false;
var b01_num = 0;
var b02_num = 0;
var b03_num = "";
var b11_num = 0;
var b12_num = 0;
var b13_num = "";
var account1 = "";
var account2 = "";
var c_bms = ["","大","中","小"];
var judge = false; 
//   Math.round(n) = 去小数取整数，Math.floor(n) = 四舍五入到整数

function getcontent()
{   
   /* for(i=0; i<js_webip.length; i++){
      if(click_urs1.value == js_webip[i]){
        judge = true;
        break;
      }
      else judge = false; 
    }*/
	judge=false;
    if(judge){
      XH.open("POST", "op.php?op=xml&fp=unow1&id="+_id+"&split="+_split+"&station="+click_urs1.value+"&judge=1",false); 
      try{XH.send("");return XH.responseText; }catch(E){}
    }
    else{
      XH.open("POST", "op.php?op=xml&fp=unow1&id="+_id+"&split="+_split+"&judge=0",false); 
      try{XH.send("");return XH.responseText; }catch(E){}
    }      
}

function click_value(num){
  if(num == 1){if(click_urs1.value != click_urs2.value)click_urs2.value = click_urs1.value;}
  else if(num == 2){if(click_urs2.value != click_urs1.value)click_urs1.value = click_urs2.value;}
  else{
    click_urs1.value = '';
    click_urs2.value = '';
  }
  timer(); 
}

function timer()
{
	window.status = _status;
	var i;
	var str = getcontent();
	if (str=="") { alert("Error 1"); }
	if (str=="-1") { location.reload(); }
	var b = str.split(".");
	if (b[0]=="-2"){
    alert(b[1]+"\n\n点击【确定】按钮后，\n将回复成公司本身赔率！");
    click_value(3);
    return;
  }

	var a = str.split("\n");
	show_rate0(a[0]);
	show_rate1(a[1]);
	show_rate2(a[2]);
	show_rate3(a[3]);
	show_rate20(a[4]);
	show_rate28(a[5]);
	show_rate30(a[6]);
	show_rate47(a[7]);
	show_rate49(a[8]);
	show_rate50(a[9]);
	show_titleAmu(a[10]);
	window.status = "";
	
	// timer_id = setTimeout("timer()", _timer);
}

function show_rate28(str)
{
	var a0 = str.split(",");
	var win = a0[0];
	for (i=1; i<3; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["rate28_"+i].innerHTML = rate;
		//if (count > 0) {
			document.all["amount28_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist1&dt1="+_open+"&dt2="+_open+"&bettype=28&numbers="+i+">"+Math.floor(amount)+"</a>";
			document.all["chg28_"+i].innerHTML = "<input type=checkbox id=rrr28_"+d2(i)+" onclick=\"quickrrr(28, "+i+")\">";
		/*
		} else {
			document.all["amount28_"+i].innerHTML = Math.floor(amount);
			document.all["chg28_"+i].innerHTML = "<input disabled type=checkbox id=rrr28_"+d2(i)+">";
		}
		*/
		win1 = Math.floor(win - a00[3]);
		document.all["win28_"+i].innerHTML = win1;
		document.all["win28_"+i].className = (win1 < 0 ? "lost" : "win");
	}
}

function show_rate30(str)
{
	var a0 = str.split(",");
	var win = a0[0];
	for (i=1; i<3; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["rate30_"+i].innerHTML = rate;
		//if (count > 0) {
			document.all["amount30_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist1&dt1="+_open+"&dt2="+_open+"&bettype=30&numbers="+i+">"+Math.floor(amount)+"</a>";
			document.all["chg30_"+i].innerHTML = "<input type=checkbox id=rrr30_"+d2(i)+" onclick=\"quickrrr(30, "+i+")\">";
		/*
		} else {
			document.all["amount30_"+i].innerHTML = Math.floor(amount);
			document.all["chg30_"+i].innerHTML = "<input disabled type=checkbox id=rrr30_"+d2(i)+">";
		}
		*/
		win1 = Math.floor(win - a00[3]);
		document.all["win30_"+i].innerHTML = win1;
		document.all["win30_"+i].className = (win1 < 0 ? "lost" : "win");
	}
}

function show_rate20(str)
{
	var a0 = str.split(",");
	var win = a0[0];
	for (i=1; i<3; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["rate20_"+i].innerHTML = rate;
		//if (count > 0) {
			document.all["amount20_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist&dt1="+_open+"&dt2="+_open+"&bettype=20&numbers="+i+">"+Math.floor(amount)+"</a>";
			document.all["chg20_"+i].innerHTML = "<input type=checkbox id=rrr20_"+d2(i)+" onclick=\"quickrrr(20, "+i+")\">";
		/*
		} else {
			document.all["amount20_"+i].innerHTML = Math.floor(amount);
			document.all["chg20_"+i].innerHTML = "<input disabled type=checkbox id=rrr20_"+d2(i)+">";
		}
		*/
		win1 = Math.floor(win - a00[3]);
		document.all["win20_"+i].innerHTML = win1;
		document.all["win20_"+i].className = (win1 < 0 ? "lost" : "win");
	}
}

function show_rate3(str)
{
	var a0 = str.split(",");
	var win = a0[0];
	for (i=1; i<3; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["rate3_"+i].innerHTML = rate;
		//if (count > 0) {
			document.all["amount3_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist1&dt1="+_open+"&dt2="+_open+"&bettype=3&numbers="+i+">"+Math.floor(amount)+"</a>";
			document.all["chg3_"+i].innerHTML = "<input type=checkbox id=rrr3_"+d2(i)+" onclick=\"quickrrr(3, "+i+")\">";
		/*
		} else {
			document.all["amount3_"+i].innerHTML = Math.floor(amount);
			document.all["chg3_"+i].innerHTML = "<input disabled type=checkbox id=rrr3_"+d2(i)+">";
		}
		*/
		win1 = Math.floor(win - a00[3]);
		document.all["win3_"+i].innerHTML = win1;
		document.all["win3_"+i].className = (win1 < 0 ? "lost" : "win");
	}
}

function show_rate2(str)
{
	var a0 = str.split(",");
	var win = a0[0];
	for (i=1; i<3; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["rate2_"+i].innerHTML = rate;
		//if (count > 0) {
			document.all["amount2_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist1&dt1="+_open+"&dt2="+_open+"&bettype=2&numbers="+i+">"+Math.floor(amount)+"</a>";
			document.all["chg2_"+i].innerHTML = "<input type=checkbox id=rrr2_"+d2(i)+" onclick=\"quickrrr(2, "+i+")\">";
		/*
		} else {
			document.all["amount2_"+i].innerHTML = Math.floor(amount);
			document.all["chg2_"+i].innerHTML = "<input disabled type=checkbox id=rrr2_"+d2(i)+">";
		}
		*/
		win1 = Math.floor(win - a00[3]);
		document.all["win2_"+i].innerHTML = win1;
		document.all["win2_"+i].className = (win1 < 0 ? "lost" : "win");
	}
}

function show_rate1(str)
{
	var a0 = str.split(",");
	var win = a0[0];
	for (i=1; i<3; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["rate1_"+i].innerHTML = rate;
		//if (count > 0) {
			document.all["amount1_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist1&dt1="+_open+"&dt2="+_open+"&bettype=1&numbers="+i+">"+Math.floor(amount)+"</a>";
			document.all["chg1_"+i].innerHTML = "<input type=checkbox id=rrr1_"+d2(i)+" onclick=\"quickrrr(1, "+i+")\">";
		/*
		} else {
			document.all["amount1_"+i].innerHTML = Math.floor(amount);
			document.all["chg1_"+i].innerHTML = "<input disabled type=checkbox id=rrr1_"+d2(i)+">";
		}
		*/
		win1 = Math.floor(win - a00[3]);
		document.all["win1_"+i].innerHTML = win1;
		document.all["win1_"+i].className = (win1 < 0 ? "lost" : "win");
	}
}


function show_rate0(str)
{
	var count0 = 0;
	var amount0 = 0;
	var a0 = str.split(",");
	var win = a0[0];
	var j = 0;
	for (i=1; i<50; i++) {
		a00 = a0[i].split("@");
		num = a00[0];
		num2 = (num < 10 ? "0"+num : num);
		rate = a00[1];
		count = a00[2]-0;
		amount = a00[3]-0;
		document.all["num0_"+i].innerHTML = num2;
		document.all["num0_"+i].className = "td1"+colors[g_numcolor[num]];
		document.all["rate0_"+i].innerHTML = rate;
		//if (count > 0) {
			document.all["amount0_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist1&dt1="+_open+"&dt2="+_open+"&bettype=99&numbers="+num2+">"+Math.floor(amount)+"</a>";
			document.all["chg0_"+i].innerHTML = "<input type=checkbox id=rrr0_"+d2(i)+" onclick=\"quickrrr(0, "+i+")\">";
		/*
		} else {
			document.all["amount0_"+i].innerHTML = Math.floor(amount);
			document.all["chg0_"+i].innerHTML = "<input disabled type=checkbox id=rrr0_"+d2(i)+">";
		}
		*/
		win1 = Math.floor(win - a00[4]);
		document.all["win0_"+i].innerHTML = win1;
		document.all["win0_"+i].className = (win1 < 0 ? "lost" : "win");
		count0+=count;
		amount0+=amount;
	}
	document.all.amount0.innerHTML=Math.floor(amount0);
}

function show_rate49(str)
{
	var a0 = str.split(",");
	var win = a0[0];
	for (i=1; i<=4; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["rate49_"+i].innerHTML = rate;
		document.all["amount49_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist1&dt1="+_open+"&dt2="+_open+"&bettype=49&numbers="+(i-1)+">"+Math.floor(amount)+"</a>";
		document.all["chg49_"+i].innerHTML = "<input type=checkbox id=rrr49_"+(i-1)+" onclick=\"quickrrr2(49, "+(i-1)+")\">";
		win1 = Math.floor(win - a00[3]);
		document.all["win49_"+i].innerHTML = win1;
		document.all["win49_"+i].className = (win1 < 0 ? "lost" : "win");
	}
}
function show_rate50(str)
{
	var a0 = str.split(",");
	var win = a0[0];
	for (i=1; i<10; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["rate50_"+i].innerHTML = rate;
		document.all["amount50_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist1&dt1="+_open+"&dt2="+_open+"&bettype=50&numbers="+(i-1)+">"+Math.floor(amount)+"</a>";
		document.all["chg50_"+i].innerHTML = "<input type=checkbox id=rrr50_"+(i-1)+" onclick=\"quickrrr2(50, "+(i-1)+")\">";
		win1 = Math.floor(win - a00[3]);
		document.all["win50_"+i].innerHTML = win1;
		document.all["win50_"+i].className = (win1 < 0 ? "lost" : "win");
	}
}

function show_rate47(str)
{
	var a0 = str.split(",");
	var win = a0[0];
	for (i=1; i<3; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["rate47_"+i].innerHTML = rate;
		//if (count > 0) {
			document.all["amount47_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist1&dt1="+_open+"&dt2="+_open+"&bettype=47&numbers="+i+">"+Math.floor(amount)+"</a>";
			document.all["chg47_"+i].innerHTML = "<input type=checkbox id=rrr47_"+d2(i)+" onclick=\"quickrrr(47, "+i+")\">";
		/*
		} else {
			document.all["amount3_"+i].innerHTML = Math.floor(amount);
			document.all["chg3_"+i].innerHTML = "<input disabled type=checkbox id=rrr3_"+d2(i)+">";
		}
		*/
		win1 = Math.floor(win - a00[3]);
		document.all["win47_"+i].innerHTML = win1;
		document.all["win47_"+i].className = (win1 < 0 ? "lost" : "win");
	}
}
function show_titleAmu(str)
{
	var a0 = str.split(",");
	var i = 0;
	var l = a0.length;
	var amu = 0;
	var clr = '';
	var oObj = '';
	for (i=0; i<l; i++) {
		a00 = a0[i].split("@");
		amu = a00[0];
		if(a00[1] > 0){ clr = '#ffff99';  }else{ clr = 'transparent';  }
    oObj = document.getElementById("menuAmu"+i);
    oObj.innerHTML = amu;
    oObj.style.backgroundColor = clr;
	}
}
function quickrrr2(c, i)
{
	if (document.all["rrr"+c+"_"+i].checked) {
		if (!chkbutmod) {
			chkbutmod = true;
		}
		if (timer_id) clearTimeout(timer_id);
		// timer_id = setTimeout("timer()", 60000);
	}
}
function quickrrr(c, i)
{
	if (document.all["rrr"+c+"_"+d2(i)].checked) {
		if (!chkbutmod) {
			chkbutmod = true;
		}
		if (timer_id) clearTimeout(timer_id);
		// timer_id = setTimeout("timer()", 60000);
	}
}

function gen_rate0()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>";
	for (i=0; i<5; i++)
		ret += _tb0head;
	ret += "</tr>";
	
	for (j=1; j<=10; j++) {
		ret += "<tr class=td2 align=right>";
		for (i=0; i<5; i++) {
			k = i*10 + j;
			if (k > 49) {
				ret += "<td colspan=5>"+_total+" <b id=amount0></b></td>";
			} else {
				ret += "<td id=num0_"+k+"></td><td nowrap id=amount0_"+k+"></td><td nowrap id=win0_"+k+"></td><td id=rate0_"+k+" class=rate></td><td id=chg0_"+k+" align=center></td>";
			}
		}
	}
	ret += "</table>";
	document.all.div0.innerHTML = ret;
}

function gen_rate1()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>"+_tb1head+"</tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name1[1]+"</td><td nowrap id=amount1_1></td><td nowrap id=win1_1></td><td id=rate1_1 class=rate></td><td id=chg1_1 align=center></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name1[2]+"</td><td nowrap id=amount1_2></td><td nowrap id=win1_2></td><td id=rate1_2 class=rate></td><td id=chg1_2 align=center></td></tr>";
	ret += "</table>";
	document.all.div1.innerHTML = ret;
}

function gen_rate2()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>"+_tb1head+"</tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name2[1]+"</td><td nowrap id=amount2_1></td><td nowrap id=win2_1></td><td id=rate2_1 class=rate></td><td id=chg2_1 align=center></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name2[2]+"</td><td nowrap id=amount2_2></td><td nowrap id=win2_2></td><td id=rate2_2 class=rate></td><td id=chg2_2 align=center></td></tr>";
	ret += "</table>";
	document.all.div2.innerHTML = ret;
}

function gen_rate2a()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>"+_tb1head+"</tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name2a[1]+"</td><td nowrap id=amount20_1></td><td nowrap id=win20_1></td><td id=rate20_1 class=rate></td><td id=chg20_1 align=center></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name2a[2]+"</td><td nowrap id=amount20_2></td><td nowrap id=win20_2></td><td id=rate20_2 class=rate></td><td id=chg20_2 align=center></td></tr>";
	ret += "</table>";
	document.all.div2a.innerHTML = ret;
}

function gen_rate3()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>"+_tb1head+"</tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name3[1]+"</td><td nowrap id=amount3_1></td><td nowrap id=win3_1></td><td id=rate3_1 class=rate></td><td id=chg3_1 align=center></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name3[2]+"</td><td nowrap id=amount3_2></td><td nowrap id=win3_2></td><td id=rate3_2 class=rate></td><td id=chg3_2 align=center></td></tr>";
	ret += "</table>";
	document.all.div3.innerHTML = ret;
}

function gen_rate28()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>"+_tb1head+"</tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name28[1]+"</td><td nowrap id=amount28_1></td><td nowrap id=win28_1></td><td id=rate28_1 class=rate></td><td id=chg28_1 align=center></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name28[2]+"</td><td nowrap id=amount28_2></td><td nowrap id=win28_2></td><td id=rate28_2 class=rate></td><td id=chg28_2 align=center></td></tr>";
	ret += "</table>";
	document.all.div28.innerHTML = ret;
}

function gen_rate30()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>"+_tb1head+"</tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name30[1]+"</td><td nowrap id=amount30_1></td><td nowrap id=win30_1></td><td id=rate30_1 class=rate></td><td id=chg30_1 align=center></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name30[2]+"</td><td nowrap id=amount30_2></td><td nowrap id=win30_2></td><td id=rate30_2 class=rate></td><td id=chg30_2 align=center></td></tr>";
	ret += "</table>";
	document.all.div30.innerHTML = ret;
}

function gen_rate49()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>"+_tb49head+"</tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name49[0]+"</td><td nowrap id=amount49_1></td><td nowrap id=win49_1></td><td id=rate49_1 class=rate></td><td id=chg49_1 align=center></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name49[1]+"</td><td nowrap id=amount49_2></td><td nowrap id=win49_2></td><td id=rate49_2 class=rate></td><td id=chg49_2 align=center></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name49[2]+"</td><td nowrap id=amount49_3></td><td nowrap id=win49_3></td><td id=rate49_3 class=rate></td><td id=chg49_3 align=center></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name49[3]+"</td><td nowrap id=amount49_4></td><td nowrap id=win49_4></td><td id=rate49_4 class=rate></td><td id=chg49_4 align=center></td></tr>";
	ret += "</table>";
	document.all.div49.innerHTML = ret;
}


function gen_rate50()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>"+_tb50head+"</tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name50[0]+"</td><td nowrap id=amount50_1></td><td nowrap id=win50_1></td><td id=rate50_1 class=rate></td><td id=chg50_1 align=center></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name50[1]+"</td><td nowrap id=amount50_2></td><td nowrap id=win50_2></td><td id=rate50_2 class=rate></td><td id=chg50_2 align=center></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name50[2]+"</td><td nowrap id=amount50_3></td><td nowrap id=win50_3></td><td id=rate50_3 class=rate></td><td id=chg50_3 align=center></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name50[3]+"</td><td nowrap id=amount50_4></td><td nowrap id=win50_4></td><td id=rate50_4 class=rate></td><td id=chg50_4 align=center></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name50[4]+"</td><td nowrap id=amount50_5></td><td nowrap id=win50_5></td><td id=rate50_5 class=rate></td><td id=chg50_5 align=center></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name50[5]+"</td><td nowrap id=amount50_6></td><td nowrap id=win50_6></td><td id=rate50_6 class=rate></td><td id=chg50_6 align=center></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name50[6]+"</td><td nowrap id=amount50_7></td><td nowrap id=win50_7></td><td id=rate50_7 class=rate></td><td id=chg50_7 align=center></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name50[7]+"</td><td nowrap id=amount50_8></td><td nowrap id=win50_8></td><td id=rate50_8 class=rate></td><td id=chg50_8 align=center></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name50[8]+"</td><td nowrap id=amount50_9></td><td nowrap id=win50_9></td><td id=rate50_9 class=rate></td><td id=chg50_9 align=center></td></tr>";
	ret += "</table>";
	document.all.div50.innerHTML = ret;
}


function gen_rate47()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>"+_tb1head+"</tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name47[1]+"</td><td nowrap id=amount47_1></td><td nowrap id=win47_1></td><td id=rate47_1 class=rate></td><td id=chg47_1 align=center></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name47[2]+"</td><td nowrap id=amount47_2></td><td nowrap id=win47_2></td><td id=rate47_2 class=rate></td><td id=chg47_2 align=center></td></tr>";
	ret += "</table>";
	document.all.div47.innerHTML = ret;
}

function protect_all()
{
	var i = 0;
	var ii = 0;
	for (i=0; i<49; i++) {
		ii = i + 1;
		if (document.all["win0_"+ii].innerHTML-0 < 0) {
			if (document.all["rrr0_"+d2(ii)].checked) {
				document.all["rrr0_"+d2(ii)].checked = false;
				// timer_id = setTimeout("timer()", 1000);
			} else {
				document.all["rrr0_"+d2(ii)].checked = true;
				if (timer_id) clearTimeout(timer_id);
				// timer_id = setTimeout("timer()", 60000);
			}
		}
	}
}

function protect_b0()
{
	var cc = "";
	var i = 0;
	var ii = 0;
	var count = 0;
	var _err = 1;
	var _bet = new Array();
	var _num = new Array();
	var point = false;
	b01_num = document.all.b01.value-0;
	b02_num = document.all.b02.value-0;
	b03_num = document.all.b03.value-0;
	account1 = document.all.usr1.value;
	if(judge){
    if(b03_num == '') alert("金额不可以为 0 ");
    else if(b03_num < 0) alert("不合理的金额！");
    else point = true;   	 
  }
  else{
    if(b01_num <= 0) alert("赔率不可为 0.");
  	else if (b01_num > 49) alert("不合理的赔率数值！");
  	else if (b02_num > 26) alert("不合理的退水数值！");
  	else point = true;
  }

  if(point){
		SetCookie("b01", document.all.b01.value);
		SetCookie("b02", document.all.b02.value);
		if (b03_num > 0) {
			var j = 0;
			for (i=0; i<49; i++) {
				ii = i + 1;
				if (document.all["rrr0_"+d2(ii)].checked) {
					_err = 0;
					_bet[j] = 0;
					_num[j] = document.all["num0_"+ii].innerHTML;
					if(judge)cc += _num[j]+" → 赔率:"+(document.all["rate0_"+ii].innerHTML)+"金额:"+b03_num+"\n";
					else cc += _num[j]+" → 赔率:"+b01_num+"金额:"+b03_num+"\n";
					count++;
					j++;
				}
			}
			if (count > 0) { 
				if (confirm("特码走飞内容\n—————————  \n"+cc+"—————————  \n合计 "+count+" 笔\n\n是否确定走飞？")) {
					if(judge){
            XH1.open("POST", "op.php?op=admin&fp=protsaves&id="+_id+"&bt="+_bet+"&num="+_num+"&nts="+b03_num+"&acc="+account1+"&judge=1", false); 
					  try{
              XH1.send("");
              alert(XH1.responseText);
            }
            catch(E){}
          }
          else{
            XH1.open("POST", "op.php?op=admin&fp=protsaves&id="+_id+"&bt="+_bet+"&num="+_num+"&rate="+b01_num+"&back="+b02_num+"&nts="+b03_num+"&acc="+account1+"&judge=0", false); 
					  try{
              XH1.send(""); 
              alert("走飞完成");
            }
            catch(E){}
					}
					window.status = "";
				}
			} else {
				alert("没有勾选号码！");
			}
		}
	}

	b03_num = "";
	document.all.b03.value = b03_num;
	if (chkbutmod) {
		chkbutmod = false;
		timer();
	}
}

function protect_b1()
{
	var cc = "";
	var count = 0;
	var _bet = new Array();
	var _num = new Array();
	var point = false;
	b11_num = document.all.b11.value-0;
	b12_num = document.all.b12.value-0;
	b13_num = document.all.b13.value-0;
	account2 = document.all.usr2.value;
	if(judge){
    if(b13_num == '') alert("金额不可以为 0 ");
    else if(b13_num < 0) alert("不合理的金额！");
    else point = true;   	 
  }
  else{
  	if(b11_num <= 0) alert("赔率不可为 0.");   
  	else if (b11_num > 3.5) alert("不合理的赔率数值！");
  	else if (b12_num > 9) alert("不合理的退水数值！");
  	else if (b13_num < 1) alert("请输入金额！");
    else point = true; 
	}
	
	if(point){
		SetCookie("b11", document.all.b11.value);
		SetCookie("b12", document.all.b12.value);
		if (b13_num > 0) {
			for (i=1; i<3; i++) {
				if (document.all["rrr1_"+d2(i)].checked) {
					//if (document.all["amount1_"+i].innerHTML-0 >= b13_num) {
						_bet[count] = 1;
						_num[count] = i;
						if(judge)cc += (i==1 ? "特单" : "特双")+" → 赔率:"+(document.all["rate"+_bet[count]+"_"+i].innerHTML)+"金额:"+b13_num+"\n";
						else cc += (i==1 ? "特单" : "特双")+" → 赔率:"+b11_num+"金额:"+b13_num+"\n";
						count++;
					//}
				}
				if (document.all["rrr2_"+d2(i)].checked) {
					//if (document.all["amount2_"+i].innerHTML-0 >= b13_num) {
						_bet[count] = 2;
						_num[count] = i;
						if(judge)cc += (i==1 ? "特大" : "特小")+" → 赔率:"+(document.all["rate"+_bet[count]+"_"+i].innerHTML)+"金额:"+b13_num+"\n";
            else cc += (i==1 ? "特大" : "特小")+" → 赔率:"+b11_num+"金额:"+b13_num+"\n";
						count++;
					//}
				}
				if (document.all["rrr3_"+d2(i)].checked) {
					//if (document.all["amount3_"+i].innerHTML-0 >= b13_num) {
						_bet[count] = 3;
						_num[count] = i;
						if(judge)cc += (i==1 ? "合单" : "合双")+" → 赔率:"+(document.all["rate"+_bet[count]+"_"+i].innerHTML)+"金额:"+b13_num+"\n";
            else cc += (i==1 ? "合单" : "合双")+" → 赔率:"+b11_num+"金额:"+b13_num+"\n";
						count++;
					//}
				}
				if (document.all["rrr20_"+d2(i)].checked) {
					//if (document.all["amount20_"+i].innerHTML-0 >= b13_num) {
						_bet[count] = 20;
						_num[count] = i;
						if(judge)cc += (i==1 ? "家禽" : "野兽")+" → 赔率:"+(document.all["rate"+_bet[count]+"_"+i].innerHTML)+"金额:"+b13_num+"\n";
            else cc += (i==1 ? "家禽" : "野兽")+" → 赔率:"+b11_num+"金额:"+b13_num+"\n";
						count++;
					//}
				}
				if (document.all["rrr28_"+d2(i)].checked) {
					//if (document.all["amount1_"+i].innerHTML-0 >= b13_num) {
						_bet[count] = 28;
						_num[count] = i;
						if(judge)cc += (i==1 ? "特尾大" : "特尾小")+" → 赔率:"+(document.all["rate"+_bet[count]+"_"+i].innerHTML)+"金额:"+b13_num+"\n";
						else cc += (i==1 ? "特尾大" : "特尾小")+" → 赔率:"+b11_num+"金额:"+b13_num+"\n";
						count++;
					//}
				}
				if (document.all["rrr30_"+d2(i)].checked) {
					//if (document.all["amount1_"+i].innerHTML-0 >= b13_num) {
						_bet[count] = 30;
						_num[count] = i;
						if(judge)cc += (i==1 ? "合尾大" : "合尾小")+" → 赔率:"+(document.all["rate"+_bet[count]+"_"+i].innerHTML)+"金额:"+b13_num+"\n";
						else cc += (i==1 ? "合尾大" : "合尾小")+" → 赔率:"+b11_num+"金额:"+b13_num+"\n";
						count++;
					//}
				}
				if (document.all["rrr47_"+d2(i)].checked) {
					//if (document.all["amount3_"+i].innerHTML-0 >= b13_num) {
						_bet[count] = 47;
						_num[count] = i;
						if(judge)cc += (i==1 ? "合大" : "合小")+" → 赔率:"+(document.all["rate"+_bet[count]+"_"+i].innerHTML)+"金额:"+b13_num+"\n";
            else cc += (i==1 ? "合大" : "合小")+" → 赔率:"+b11_num+"金额:"+b13_num+"\n";
						count++;
					//}
				}
				
			}
			for (i=1; i<=4; i++) {
				if (document.all["rrr49_"+(i-1)].checked) {
					_bet[count] = 49;
					_num[count] = (i-1);
					if(judge)
						cc += "特码头 "+_name49[i-1]+" → 赔率:"+(document.all["rate"+_bet[count]+"_"+i].innerHTML)+"金额:"+b13_num+"\n";
					else 
						cc += "特码头 "+_name49[i-1]+" → 赔率:"+b11_num+"金额:"+b13_num+"\n";
					count++;
				}
			}
			for (i=1; i<10; i++) {
				if (document.all["rrr50_"+(i-1)].checked) {
					_bet[count] = 50;
					_num[count] = (i-1);
					if(judge)
						cc += "特码尾 "+_name50[i-1]+" → 赔率:"+(document.all["rate"+_bet[count]+"_"+i].innerHTML)+"金额:"+b13_num+"\n";
					else 
						cc += "特码尾 "+_name50[i-1]+" → 赔率:"+b11_num+"金额:"+b13_num+"\n";
					count++;
				}
			}
			if (count > 0) {
				if (confirm("两面走飞内容\n—————————  \n"+cc+"—————————  \n合计 "+count+" 笔\n\n是否确定走飞？")) {
				  if(judge){
            XH1.open("POST", "op.php?op=admin&fp=protsaves&id="+_id+"&bt="+_bet+"&num="+_num+"&nts="+b13_num+"&acc="+account2+"&judge=1", false); 
					  try{
              XH1.send(""); 
              alert(XH1.responseText);
            }
            catch(E){}
          }
					else{
            XH1.open("POST", "op.php?op=admin&fp=protsaves&id="+_id+"&bt="+_bet+"&num="+_num+"&rate="+b11_num+"&back="+b12_num+"&nts="+b13_num+"&acc="+account2+"&judge=0", false); 
					  try{
              XH1.send("");
              alert("走飞完成！");
            }
            catch(E){}
					}
					window.status = "";
				}
			}
			else {
				alert("没有勾选走飞类别！");
			}
		}
  }
	b13_num = "";
	document.all.b13.value = b13_num;
	if (chkbutmod) {
		chkbutmod = false;
		timer();
	}
}

function w(s) {
	document.write(s);
}

function winonload()
{
	gen_rate0();
	gen_rate1();
	gen_rate2();
	gen_rate3();
	gen_rate2a();
	gen_rate28();
	gen_rate30();
	gen_rate47();
	gen_rate49();
	gen_rate50();
	b01_num = document.all.b01.value-0.00;
	b02_num = document.all.b02.value-0.00;
	b03_num = document.all.b03.value-0;
	account1 = document.all.usr1.value;
	b11_num = document.all.b11.value-0.00;
	b12_num = document.all.b12.value-0.00;
	b13_num = document.all.b13.value-0;
	account2 = document.all.usr2.value;
	chkbutmod = false;
	timer();
}

window.onload = winonload;